import { NextResponse } from 'next/server';
import { SYSTEM_CONFIG } from '@/lib/config';

export async function GET() {
  try {
    // 只返回前端需要的配置
    const clientConfig = {
      sdWebUI: {
        baseUrl: SYSTEM_CONFIG.sdWebUI.baseUrl,
        defaultPort: SYSTEM_CONFIG.sdWebUI.defaultPort,
      },
      api: {
        baseUrl: SYSTEM_CONFIG.api.baseUrl,
        timeout: SYSTEM_CONFIG.api.timeout,
      },
      version: SYSTEM_CONFIG.version,
      title: SYSTEM_CONFIG.title,
    };

    return NextResponse.json(clientConfig);
  } catch (error) {
    return NextResponse.json(
      { error: 'Failed to load configuration' },
      { status: 500 }
    );
  }
}
